package com.lmk.t02;

public class TicketTest {
    public static void main(String[] args) {
        Station st=new Station(100);
        Thread t1=new Thread(new HuangNiu("张三",st));
        Thread t2=new Thread(new HuangNiu("李四",st));
        t1.start();
        t2.start();

    }
    static class  HuangNiu implements Runnable{
        private  Station station;
        private  String name;

        public HuangNiu(String name,Station station ) {
            this.station = station;
            this.name=name;
        }

        @Override
        public void run() {
            while (true){
               boolean ok= this.station.sale(this.name);
                if(!ok) break;
            }
        }
    }
}
